import { useState } from "react"
import { useNavigate } from "react-router-dom"

function dian(){
    let [list,setList]=useState([
        {id:1,name:'拿铁'},
        {id:2,name:'生耶'},
        {id:3,name:'生酪'},
    ])
    let history=useNavigate()
    return (
        <div>
        <div className="main">
            <ul>
               {
                list.map(item=>{
                    return <li key={item.id} onClick={()=>history(`/defail/${item.id}`)}>{item.name}</li>
                })
            } 
            </ul>
            
        </div>
        
        </div>
    )
}
export default dian